﻿using System;

namespace TSharp.Core.Repository
{
    /// <summary>
    /// The interface for wrapps concrete implementation of unit of work pattern.
    /// </summary>
    public interface IUnitOfWorkFactory
    {
        /// <summary>
        /// Warps the specified is readonly.
        /// </summary>
        /// <param name="isReadonly">if set to <c>true</c> [is readonly].</param>
        /// <param name="containDeleted">if set to <c>true</c> [contain deleted].</param>
        /// <param name="context">The context.</param>
        /// <returns>IUnitOfWork.</returns>
        IUnitOfWork WarpContext(bool isReadonly, bool containDeleted, object context);
        /// <summary>
        /// Begins the unit of work.
        /// </summary>
        /// <param name="isReadonly">if set to <c>true</c> [is readonly].</param>
        /// <param name="containDeleted">if set to <c>true</c> [contain deleted].</param>
        /// <param name="contextName">Name of the context.</param>
        /// <returns>IUnitOfWork.</returns>
        IUnitOfWork BeginUnitOfWork(bool isReadonly, bool containDeleted, string contextName);
        /// <summary>
        /// Begins the unit of work.
        /// </summary>
        /// <param name="isReadonly">if set to <c>true</c> [is readonly].</param>
        /// <param name="containDeleted">if set to <c>true</c> [contain deleted].</param>
        /// <returns>IUnitOfWork.</returns>
        IUnitOfWork BeginUnitOfWork(bool isReadonly, bool containDeleted);
        /// <summary>
        /// Begins unit of work.
        /// </summary>
        IUnitOfWork BeginUnitOfWork(bool isReadonly);
        /// <summary>
        /// Begins the unit of work.
        /// </summary>
        /// <returns></returns>
        IUnitOfWork BeginUnitOfWork();
        /// <summary>
        /// Ends unit of work.
        /// </summary>
        void EndUnitOfWork(IUnitOfWork unitOfWork);
    }
}
